
<?php

CHelper::registerCssFile(Yii::app()->params['assetsUrl'] . '/css/bootstrap.min.css');
CHelper::registerCssFile(Yii::app()->params['assetsUrl'] . '/fonts/iconfont/iconfont.css');
CHelper::registerCssFile(Yii::app()->params['assetsUrl'] . '/css/vpl-season2.css');
CHelper::registerCssFile(Yii::app()->params['assetsUrl'] . '/css/vpl-season2-base.css');
CHelper::registerCssFile(Yii::app()->params['assetsUrl'] . '/css/ti6.css');

?>

<div class="bodyer">
    <div class="ti6-bg">

        <!--ti6头部说明-->
        <div class="container">
            <div class="ti6-top-intro text-center f-18">
                在地理上，南海离中国更近些   在小红本上，答案离我们更近些
            </div>
        </div>

        <!--ti6相关-->
        <div class="vpl-about">
            <div class="ti6-liveAndRecent-bg">
                <div class="container">
                    <!--直播-->
                    <div class="vpl-about-live mr-20 pull-left" id="vpl-about-live">
                        <ul class="nav nav-tabs mediaList">
                            <li class="mediaList-item">
                                <a href="#" data-toggle="tab"></a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane fade in ti6-vedioLive-bg active">
                                <!-- <iframe width="770" height="455" src="http://www.youtube.com/embed/szIEr2F61DU" frameborder="0" allowfullscreen></iframe> -->
                            </div>
                        </div>
                    </div>

                    <!--近期赛事-->
                    <div class="vpl-about-recentGame f12 pull-left">
                        <div class="date-nav">
                            <a href="javascript:void(0)" class="date-forward">
                                <i class="iconfont icon-forward"></i>
                            </a>
                            <div class="date-nav-list" style="overflow:hidden">
                                <ul class="carousel-nav clearfix" id="recent-schedule-template-place" style="width:1300px">

                                </ul>
                            </div>
                            <a href="javascript:void(0)" class="date-afterward">
                                <i class="iconfont icon-afterward"></i>
                            </a>
                        </div>
                        <ul class="recentGame-list" id="recent-game-template-place">

                        </ul>

                    </div>
                </div>
            </div>


            <!--侧导航-->
            <div class="vpl-about-sideNav ti6-about-sideNav" style="display: none;">
                <ul class="sideNav-list">
                    <li class="sideNav-item">
                        <a href="#ti6-about-live">赛事直播</a>
                    </li>
                    <li class="sideNav-item">
                        <a href="#ti6-intro">活动说明</a>
                    </li>
                    <li class="sideNav-item">
                        <a href="#ti6-stars">明星阵容</a>
                    </li>
                    <li class="sideNav-item">
                        <a href="#ti6-exerciseBook">作业本</a>
                    </li>
                    <li class="sideNav-item">
                        <a href="#ti6-eventIntro">赛事资讯</a>
                    </li>
                    <li class="sideNav-item">
                        <a href="#ti6-gameGuess">比赛竞猜</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <!--活动说明-->
    <div class="container">
        <div class="ti6-activityIntro">
            <h3 class="ti6-activityIntro-title"></h3>
            <hr class="ti6-title-bottomBorder">
            <p class="ti6-activityIntro-content">
                TI6国际邀请赛的战火重燃，又到了小本子抄作业的时候！
                为了方便大家在互动指南上写出更加准确的预测，VPGAME收录众多职业选手、教练、解说、主播的预测答案，在本页面上不仅能浏览大数据统计出的热门答案，也能翻看每个选手的具体答案。
                当然答案仅供参考，还记得被某师傅支配的恐惧么？
            </p>
        </div>

    </div>
</div>
</div>









<!-- --------------------- recent-game ----------------------- -->
<script type="text/html" id="recent-schedule-template">
    <%for(var i=0; i<body.data.length; i++){%>
    <li class="date-nav-item pull-left <%if(body.data[i] == body.now){%>active<%}%>" data-time="<%= body.data[i] %>">
        <a href="javascript:void(0)" class="date-link"><%= toCnDate(body.data[i]) %></a>
    </li>
    <%}%>
</script>

<script type="text/html" id="recent-game-template">
    <%for(var i=0; i<body.matchs.length; i++){%>
    <li class="recentGame-list-item">
        <p class="recentGame-status
        <%if(body.matchs[i].match_info.type != 'normal'){%>font-statusStop<%}%>
        <%if(body.matchs[i].match_info.type == 'normal' && body.date >= body.matchs[i].match_info.game_time){%>font-statusDoing<%}%>
        ">
            <%if(body.matchs[i].match_info.type == 'normal' && body.date < body.matchs[i].match_info.game_time){%>
            <%= toDate(body.matchs[i].match_info.game_time, 'hh:mm') %>
            <%}else if(body.matchs[i].match_info.type == 'normal' ){%>
            <%= body.matchs[i].match_info.status %>
            <%}else if(body.matchs[i].match_info.type != undefined){%>
            已结束
            <%}%>
        </p>
        <div class="teams-about">
            <div class="teams-a">
                <img src="<%= imgsrc(body.matchs[i].team_left.logo, '50x30', 'empty.png') %>" alt="" height="30" width="50">
            </div>
            <%if(body.date > body.matchs[i].match_info.game_time){%>
            <div class="battle-result">
                <span><%= body.matchs[i].match_info.left_team_score %></span>-<span><%= body.matchs[i].match_info.right_team_score %></span>
            </div>
            <%}else{%>
            <div class="battle-form"><%= body.matchs[i].match_info.round %></div>
            <%}%>
            <div class="teams-b">
                <img src="<%= imgsrc(body.matchs[i].team_right.logo, '50x30', 'empty.png') %>" alt="" width="50" height="30">
            </div>
        </div>
        <%if(body.matchs[i].match_info.id != undefined){%>
        <a href="<%= '/match/'+body.matchs[i].match_info.id+'.html?category=dota' %>" class="recentGame-entrence <%if(true){%>font-statusStop<%}%>">竞猜</a>
        <%}%>
    </li>
    <%}%>
    <%if(body.matchs.length == 0){%>
    <li class="recentGame-list-item text-center" style="padding:20px 0">暂无比赛信息</li>
    <%}%>
    <li class="more-guess">
        <a href="http://dota2.vpgame.com/match.html">更多竞猜</a>
    </li>
</script>



<!-- --------------------- news ----------------------- -->
<script type="text/html" id="news-carousel-template">
    <%var p = ['main-pos', 'right-pos', 'back-pos', 'left-pos']%>
    <%for(var i=0; i<4; i++){%>
    <li class="items <%= p[i] %>" id="<%= i+1 %>">
        <a href="/event/dota/<%= body[i].id %>" target="_blank" style="display: block;color: #bdc0c3;">
            <img width="461" height="277" src="<%= imgsrc(body[i].poster, '461x277', '') %>"/>
            <b class="opacity-b"></b>
            <h4 class="vpl-bottomNews"><%=body[i].title%></h4>
        </a>
    </li>
    <%}%>
</script>

<script type="text/html" id="news-list-template">
    <%for(var i=4;i<body.length;i++){%>
    <li class="vpl-imgNews-list-item ellipsis">
        <a href="/event/dota/<%= body[i].id %>" target="_blank"><i class="iconfont icon-hexagon f14"></i><span class="vpl-news-link" title="<%= body[i].title %>"><%= body[i].title %></span></a>
    </li>
    <%}%>
</script>

<!-- --------------------- match tabs ----------------------- -->
<script type="text/html" id="three-matches-template">
    <!--<li class="league-yxs active">
        <a href="#home" data-toggle="tab">
            <p class="f16"><%= body.item[0].schedue.name %></p>
            <p><span class="ib mr10">2016年7月24日</span>至<span class="ib ml10">2016年7月26日</span></p>
        </a>
    </li>-->
    <li class="league-xzs">
        <a href="#xzs" data-toggle="tab">
            <p class="f16"><%= body.item[0].schedue.name %></p>
            <p><span class="ib mr10"><%= toCnDate(body.item[0].schedue.bengin_time, 'ymd') %></span>至<!--
        --><span class="ib ml10"><%= toCnDate(body.item[0].schedue.end_time, 'ymd') %></span>
            </p>
        </a>
    </li>
    <!--<li class="league-yxs active">
        <a href="#home" data-toggle="tab">
            <p class="f16"><%= body.item[0].schedue.name %></p>
            <p><span class="ib mr10">2016年7月24日</span>至<span class="ib ml10">2016年7月26日</span></p>
        </a>
    </li>-->
    <li class="league-js">
        <a href="#js" data-toggle="tab">
            <p class="f16"><%= body.item[1].schedue.name %></p>
            <p><span class="ib mr10"><%= toCnDate(body.item[1].schedue.bengin_time, 'ymd') %></span>至<!--
        --><span class="ib ml10"><%= toCnDate(body.item[1].schedue.end_time, 'ymd') %></span>
            </p>
        </a>
    </li>
</script>

<!-- --------------------- yuxuan ----------------------- -->
<!--<script type="text/html" id="yuxuan-match-template">
<% var i = 0; %>
<div class="basicColomn">
    <div class="roundList mb40">
        <div class="round1">
            <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                <%if(rounds[i].a_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                <%}%>
            </p>
            <p class="flowChart-time">
                <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
            </p>
            <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                <%if(rounds[i].b_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                <%}%>
            </p>
        </div>
        <div class="round1-info">
            <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
            <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
            <hr class="next-lineShort <%if(rounds[i].a_team_scoure != 0 || rounds[i].b_team_scoure != 0){%>active<%}%>">

            <p><%if(rounds[i].a_team_scoure != undefined){%>
                <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
            <%}%></p>
            <% i++; %>
        </div>
    </div>
    <div class="roundList mb40">
        <div class="round1">
            <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                <%if(rounds[i].a_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                <%}%>
            </p>
            <p class="flowChart-time">
                <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
            </p>
            <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                <%if(rounds[i].b_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                <%}%>
            </p>
        </div>
        <div class="round1-info">
            <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
            <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
            <hr class="next-lineShort <%if(rounds[i].a_team_scoure != 0 || rounds[i].b_team_scoure != 0){%>active<%}%>">
            <p><%if(rounds[i].a_team_scoure != undefined){%>
                <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
            <%}%></p>
            <% i++; %>
        </div>
    </div>

</div>

<div class="basicColomn">
    <div class="roundList">
        <div class="round3 mt46">
            <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                <%if(rounds[i].a_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                <%}%>
            </p>
            <p class="flowChart-timeHigh">
                <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
            </p>
            <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                <%if(rounds[i].b_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                <%}%>
            </p>
        </div>
        <div class="round3-info">
            <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
            <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
            <hr class="next-lineShort <%if(rounds[i].a_team_scoure != 0 || rounds[i].b_team_scoure != 0){%>active<%}%>">
            <p><%if(rounds[i].a_team_scoure != undefined){%>
                <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
            <%}%></p>
            <% i++; %>
        </div>
    </div>
</div>

<div class="basicColomn">
    <div class="h134"></div>
    <div class="roundList">
        <div class="round1">
            <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                <%if(rounds[i].a_team_logo != undefined){%>
                <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                <%}%>
            </p>
        </div>
    </div>
</div>
</script>-->

<!-- --------------------- xiaozu ----------------------- -->
<script type="text/html" id="xiaozu-match-score-template">
    <table class="team-score">
        <tr>
            <th width="150">队伍</th>
            <th width="75">胜</th>
            <th width="75">负</th>
            <th>积分</th>
        </tr>
        <%for(var i=0;i<integral.length;i++){%>
        <tr>
            <td class="first-td">
                <img src="<%=imgsrc(integral[i].logo, '50x30', 'black-avatar-empty.png')%>" alt="" width="50" height="30">
                <span><%=integral[i].team%></span>
            </td>
            <td class="winner"><%=integral[i].win%></td>
            <td class="loser"><%=integral[i].lose%></td>
            <td class="score"><%=integral[i].integral%></td>
        </tr>
        <%}%>
    </table>
</script>

<script type="text/html" id="xiaozu-match-template">
    <table class="team">
        <tr>
            <th colspan="3">小组赛对阵图</th>
        </tr>
        <%for(var i=page_start; i<page_start + page_size && i<plan.length; i++){%>
        <tr>
            <td width="200" class="text-left">
                <img class="ml-30" src="<%=imgsrc(plan[i].a_team_logo, '50x30', 'black-avatar-empty.png')%>" alt="" width="50" height="30">
                <span><%=plan[i].a_team%></span>
            </td>
            <td class="text-center">
                <% if (isOrdoing(plan[i].match_time)){%>
                <span class="scoring"><%=plan[i].a_team_scoure%> - <%=plan[i].b_team_scoure%></span>
                <%if (plan[i].a_team_scoure==0&&plan[i].b_team_scoure==0) {%>
                <span class="ing">( 进行中 )</span>
                <%}else{%>
                <span class="end">( 已结束 )</span>
                <%}%>
                <%}else{%>
                <span class="scoring">VS</span>
                <%}%>
            </td>
            <td width="200" class="text-right">
                <span><%=plan[i].b_team%></span>
                <img class="mr-30" src="<%=imgsrc(plan[i].b_team_logo, '50x30', 'black-avatar-empty.png')%>" alt="" width="50" height="30">
            </td>
        </tr>
        <%}%>
    </table>
    <div class="circle-pagination vpl-xiaozu-pagination"><ul id="yw2">
        <%if(page_i != 1){%>
        <li class="prev"><a href="javascript:void(0)">&lt;</a></li>
        <%}%>
        <%for(var p=0; p<page_num; p++){%>
        <li class="page <%if(p+1==page_i){%>active<%}%>"><a href="javascript:void(0)"><%=p+1%></a></li>
        <%}%>
        <%if(page_i != page_num){%>
        <li class="next"><a href="javascript:void(0)">&gt;</a></li></ul>
        <%}%>
    </div>
</script>

<!-- --------------------- juesai ----------------------- -->
<script type="text/html" id="juesai-match-template">
    <%var i=0;%>
    <div class="basicColomn">
        <div class="roundList mb40">
            <div class="round1">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round1-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <p class="top"><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
                <hr class="next-line <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
            </div>
            <%i++%>
        </div>
        <div class="roundList mb150">
            <div class="round1">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round1-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <p class="top"><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
                <hr class="next-line <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
            </div>
            <%i++%>
        </div>
        <div class="roundList mb40">
            <div class="round1">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round1-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
            </div>
            <%i++%>
        </div>
        <div class="roundList">
            <div class="round1">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round1-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
    </div>
    <div class="basicColomn">
        <div class="colomn1"></div>
        <div class="roundList mb40">
            <div class="round2">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round2-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
        <div class="roundList mb40">
            <div class="round2">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round2-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
    </div>
    <div class="basicColomn">
        <div class="roundList">
            <div class="round3 separate">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-timeHigh">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round3-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-line <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p class="top"><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
        <div class="roundList">
            <div class="round3">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-timeHigh">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round3-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
    </div>
    <div class="basicColomn">
        <div class="colomn2"></div>
        <div class="roundList">
            <div class="round4">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round4-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
    </div>
    <div class="basicColomn">
        <div class="roundList mt134">
            <div class="round5">
                <p class="flowChart-teamA ellipsis <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].a_team %>">
                    <%if(rounds[i].a_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].a_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].a_team %>
                    <%}%>
                </p>
                <p class="flowChart-time">
                    <%if(rounds[i].match_time != undefined){%><%= toDate(rounds[i].match_time, 'MM/dd hh:mm') %><%}%>
                </p>
                <p class="flowChart-teamB ellipsis <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>" title="<%= rounds[i].b_team %>">
                    <%if(rounds[i].b_team_logo != undefined){%>
                    <img src="<%= imgsrc(rounds[i].b_team_logo, '40x31', 'black-avatar-empty.png') %>" alt="" height="31" width="40"><%= rounds[i].b_team %>
                    <%}%>
                </p>
            </div>
            <div class="round5-info">
                <b class="connect-border-top connect-line <%if(rounds[i].a_team_scoure>rounds[i].b_team_scoure){%>active<%}%>"></b>
                <b class="connect-border-bottom connect-line <%if(rounds[i].a_team_scoure<rounds[i].b_team_scoure){%>active<%}%>"></b>
                <hr class="next-lineShort <%if(rounds[i].a_team_scoure > 0 || rounds[i].b_team_scoure > 0){%>active<%}%>">
                <p><%if(rounds[i].a_team_scoure != undefined){%>
                    <%=rounds[i].a_team_scoure+' : '+rounds[i].b_team_scoure%>
                    <%}%></p>
            </div>
            <%i++%>
        </div>
    </div>
    <div class="vpl-championWrap">
        <div class="vpl-champion"></div>
        <%if(rounds[i].a_team != undefined){%>
        <p><span class="vpl-championName">冠军<%=rounds[i].a_team%></span></p>
        <%}%>
    </div>
</script>

<?php
CHelper::registerScriptFile(Yii::app()->params['assetsUrl'] . '/js/jquery.min.js');
CHelper::registerScriptFile(Yii::app()->params['assetsUrl'] . '/js/bootstrap.min.js');
CHelper::registerScriptFile(Yii::app()->params['assetsUrl'] . '/js/template-native.js');
CHelper::registerScriptFile(Yii::app()->params['assetsUrl'] . '/js/require.js');
?>

<script>
    //slideshow style interval

    //pause slideshow and reinstantiate on mouseout
    var autoSwap;
    $('.vpl-carousel').hover(function () {
        clearInterval(autoSwap);
    }, function () {
        autoSwap = setInterval( swap,3500);
    });

    //global variables
    var items = [];
    var startItem = 1;
    var position = 0;
    var itemCount = 4;
    var leftpos = itemCount;
    var resetCount = itemCount;

    //unused: gather text inside items class
    $('li.items').each(function(index) {
        items[index] = $(this).text();
    });

    //swap images function
    function swap(action) {
        var direction = action;

        //moving carousel backwards
        if(direction == 'counter-clockwise') {
            var leftitem = $('.left-pos').attr('id') - 1;
            if(leftitem == 0) {
                leftitem = itemCount;
            }

            $('.right-pos').removeClass('right-pos').addClass('back-pos');
            $('.main-pos').removeClass('main-pos').addClass('right-pos');
            $('.left-pos').removeClass('left-pos').addClass('main-pos');
            $('#'+leftitem+'').removeClass('back-pos').addClass('left-pos');

            startItem--;
            if(startItem < 1) {
                startItem = itemCount;
            }
        }

        //moving carousel forward
        if(direction == 'clockwise' || direction == '' || direction == null ) {
            function pos(positionvalue) {
                if(positionvalue != 'leftposition') {
                    //increment image list id
                    position++;

                    //if final result is greater than image count, reset position.
                    if((startItem+position) > resetCount) {
                        position = 1-startItem;
                    }
                }

                //setting the left positioned item
                if(positionvalue == 'leftposition') {
                    //left positioned image should always be one left than main positioned image.
                    position = startItem - 1;

                    //reset last image in list to left position if first image is in main position
                    if(position < 1) {
                        position = itemCount;
                    }
                }

                return position;
            }

            $('#'+ startItem +'').removeClass('main-pos').addClass('left-pos');
            $('#'+ (startItem+pos()) +'').removeClass('right-pos').addClass('main-pos');
            $('#'+ (startItem+pos()) +'').removeClass('back-pos').addClass('right-pos');
            $('#'+ pos('leftposition') +'').removeClass('left-pos').addClass('back-pos');

            startItem++;
            position=0;
            if(startItem > itemCount) {
                startItem = 1;
            }
        }
    }

    //next button click function
    $('#next').click(function() {
        swap('clockwise');
    });

    //prev button click function
    $('#prev').click(function() {
        swap('counter-clockwise');
    });

    //if any visible items are clicked
    $('.items').click(function() {
        if($(this).attr('class') == 'items left-pos') {
            swap('counter-clockwise');
        }
        else {
            swap('clockwise');
        }
    });

    /* ======================= 分割割割割割割割割割割线 ========================*/

    (function(){
        $('#header .nav').hide();
        $('#sidebar-sm').hide();
        // $('.vpl-about-sideNav').hide();

        $(document).on('yuxuan', function(e, o){
            var PLACE_NUM = 7;
            var yuxuanT= 'yuxuan-match-template';
            var i = 0;
            o.group == 'A' ? i = 0 : 0;
            o.group == 'B' ? i = 1 : 0;
            // var rounds = [[], [], []];
            // data.body.item[0].schedue.groups[i].group.plan.forEach(function(e, i){rounds[0].push(e); });
            var sortedRounds = data.body.item[0].schedue.groups[i].group.plan;
            sortedRounds.sort(function(a, b){
                return (a.step * 100 + a.slot) - (b.step * 100 + b.slot);
            });
            for(var i=0;i<PLACE_NUM - sortedRounds.length; i++){sortedRounds.push({}); }
            console.log(sortedRounds);
            $('#'+yuxuanT+'-place').html( template(yuxuanT, {rounds:sortedRounds}) );

        }).on('xiaozu', function(e, o){
            var xiaozuT = 'xiaozu-match-template';
            var i = 0;
            o.group == 'A' ? i = 0 : 0;
            o.group == 'B' ? i = 1 : 0;
            var rounds = data.body.item[0].schedue.groups[i].group;
            rounds.page_i = o.page_i || 1;
            rounds.page_size = 7;
            rounds.page_num = Math.ceil(rounds.plan.length / 7);
            rounds.page_start = rounds.page_size * (rounds.page_i-1);
            $('#'+xiaozuT+'-place').empty().append( template(xiaozuT, rounds) );
            $('#'+xiaozuT+'-place').prepend( template('xiaozu-match-score-template', rounds) );

        }).on('juesai', function(e, o){
            var PLACE_NUM = 21;
            var juesaiT = 'juesai-match-template';
            var i = 0;
            var sortedRounds = data.body.item[1].schedue.groups[i].group.plan;
            sortedRounds.sort(function(a, b){
                return (a.step * 100 + a.slot) - (b.step * 100 + b.slot);
            });
            for(var i=0;i<PLACE_NUM - sortedRounds.length; i++){sortedRounds.push({}); }
            console.log('juesai', sortedRounds);
            $('#'+juesaiT+'-place').html( template(juesaiT, {rounds:sortedRounds}) );

        }).on('tv', function(){
            var li = $('#vpl-about-live').find('li').eq(0);
            var panel = $('#vpl-about-live').find('.tab-pane').eq(0);
            $.each(data.body.live, function(i, e){
                li.before(li.clone().find('a').html(e.name).attr('href', '#tv-tab'+(i+1)).end());
                panel.before(panel.clone().attr('id', 'tv-tab'+(i+1)).html(e.code));
            });
            li.siblings().first().find('a').tab('show');
            li.detach();
            panel.detach();
            // $('#douyu').html(data.body.live[0].code);
            // $('#huomao').html(data.body.live[1].code);
            // $('#zhanqi').html(data.body.live[2].code);

        }).on('three-matches', function(){
            $('#myTab').html( template('three-matches-template', data) );
            $('.league-xzs').children().click();

        }).on('recent-matches', function(e, date){
            var o = (date != undefined ? {begin:date} : {});
            $.get(CONFIG.yii_webapi_domain + '/topic/vpl/matchlist', o, function(data){
                var tA = 'recent-schedule-template';
                var tB = 'recent-game-template';
                data.body.date = Date.now() / 1000;
                $('#'+tA+'-place').children().length == 0 ? $('#'+tA+'-place').html( template(tA, data) ) : 0;
                $('#'+tB+'-place').html( template(tB, data) );
                $(document).trigger('date-nav-init');
            }, 'jsonp');

        });

        var data = {};
        $.get(CONFIG.yii_webapi_domain + '/v2/topic/vpl/index', {code:'vpl'}, function(o){
            data = o; console.log(data);
            // $(document).trigger('yuxuan', {group:'A'});
            $(document).trigger('tv');
            $(document).trigger('xiaozu', {group:'A'});
            $(document).trigger('juesai');
            $(document).trigger('three-matches');
        }, 'jsonp');

        $.get(CONFIG.yii_webapi_domain + '/v2/topic/vpl/topicarticle?article[tags]=vpl', function(data){
            console.log(99,data);
            $('#news-carousel-template-place').html( template('news-carousel-template', data) );
            $("#news-list-template-place").html( template('news-list-template', data) );
            autoSwap = setInterval( swap,3500);
        }, 'jsonp');

        $(document).trigger('recent-matches');

        // $('#recent-game-template-place').prepend( template('recent-game-template', {}) );
        // $.get(CONFIG.yii_webapi_domain + '/topic/topic/ranking', {code:'vpl'}, function(data){
        //     $('#xiaozu-match-template-place').prepend( template('xiaozu-match-score-template', {}) );
        // });

        // http://yii.webapi.dev.vpgame.cn/v2/topic/topic/index?callback=jQuery19106395318237582421_1467186635305&code=&_=1467186635306

    })();

    (function(){
        var t = 'recent-schedule-template-place';
        // console.log('mabi', one.width());
        var sight = {left:null, center:null, right:null};
        sight.moveR = function(){
            if(this.right != null && this.right.next().length != 0) {
                this.left = this.center;
                this.center = this.right;
                this.right = this.right.next();
                return true;
            }
            return false;
        }
        sight.moveL = function(){
            if(this.left != null && this.left.prev().length != 0) {
                this.right = this.center;
                this.center = this.left;
                this.left = this.left.prev();
                return true;
            }
            return false;
        }

        $(document).one('date-nav-init', function(){
            // $('#'+t).children().eq(1).addClass('center');
            var active = $('#'+t).children().filter('.active');
            console.log('ww', active.next());
            active.prev().length == 0 ? sight.center = active.next() : 0;
            active.next().length == 0 ? sight.center = active.prev() : 0;
            active.prev().length != 0 && active.next().length != 0 ? sight.center = active : 0;
            sight.left = sight.center.prev() || null;
            sight.right = sight.center.next() || null;
            $('#'+t).animate({left:'+='+ (-1 * sight.left.prevAll().length * sight.center.width()) }, 'slow');
            // sight.left = $('#'+t).children().eq(0) || null;
            // sight.center = $('#'+t).children().eq(1) || null;
            // sight.right = $('#'+t).children().eq(2) || null;
        });
        $(document).on('click', '.date-afterward', function(){
            $(document).trigger('date-nav-init');
            if(sight.left.hasClass('active')) {sight.center.click();
            } else if(sight.center.hasClass('active')) {
                var ready = sight.moveR();
                ready ? $('#'+t).animate({left:'+='+-(sight.center.width()) }, 'fast') : 0;
                ready ? sight.center.click() : 0;
                !ready && sight.right != null ? sight.right.click() : 0;
            } else if(sight.right.hasClass('active')) {
                sight.moveR() ? $('#'+t).animate({left:'+='+-(sight.center.width()) }, 'fast') : 0;
            }

        }).on('click', '.date-forward', function(){
            $(document).trigger('date-nav-init');
            if(sight.right.hasClass('active')) {sight.center.click();
            } else if(sight.center.hasClass('active')) {
                var ready = sight.moveL();
                ready ? $('#'+t).animate({left:'+='+(sight.center.width()) }, 'fast') : 0;
                ready ? sight.center.click() : 0;
                !ready && sight.left != null ? sight.left.click() : 0;
            } else if(sight.left.hasClass('active')) {
                sight.moveL() ? $('#'+t).animate({left:'+='+(sight.center.width()) }, 'fast') : 0;
            }

        }).on('click', '.date-nav-item', function(){
            $(document).trigger('date-nav-init');
            $(this).parent().children().removeClass('active');
            $(this).addClass('active');
            $(document).trigger('recent-matches', $(this).attr('data-time'));

        });

    })();

    (function(){
        var group = 'A';
        var navs = [
            'vpl-about-live',
            'vpl-intro',
            'vpl-leagueFixtures',
            'vpl-teamIntro',
            'vpl-eventIntro'
        ];
        $(document).on('click', '.team-switch-btn button', function(){
            $(this).parent().children().toggleClass('active');
            $(this).parent().find('.A').hasClass('active') ? group = 'A' : 0;
            $(this).parent().find('.B').hasClass('active') ? group = 'B' : 0;
            $(document).trigger('xiaozu', {group:group, page_i:1});

        }).on('click', '.vpl-xiaozu-pagination a', function(){
            var page = parseInt($('.vpl-xiaozu-pagination').find('.page.active').find('a').html() );
            $(this).parent().hasClass('page') ? page = parseInt($(this).html() ) : 0;
            $(this).parent().hasClass('next') ? page++ : 0;
            $(this).parent().hasClass('prev') ? page-- : 0;
            $(document).trigger('xiaozu', {group:group, page_i:page });
        }).on('click', '.sideNav-item a', function(){
            $('.sideNav-item a').removeClass('hover');
            $(this).addClass('hover');
            var id = $(this).attr('href');

        }).on('scroll', function(){
            var t = $(window).scrollTop();
            var which = '';
            $.each(navs, function(i, str){
                t >= $('#'+str).offset().top ? which = '[href=#'+str+']' : 0;
            });
            $(which).click();

            // alert('eee');
        });

    })();

    template.helper('toCnDate', function(date, type){
        var d = new Date(date*1000);
        if(type == undefined) return (d.getMonth() + 1) + '月' + d.getDate() + '日';
        if(type == 'ymd') return d.getFullYear() + '年' + (d.getMonth() + 1) + '月' + d.getDate() + '日';
    });

    template.helper('toDate',function(date,format){
        var paddNum = function(num){
            num += "";
            return num.replace(/^(\d)$/,"0$1");
        }
        date = new Date(date*1000);
        //指定格式字符
        var cfg = {
            yyyy : date.getFullYear() //年 : 4位
            ,yy : date.getFullYear().toString().substring(2)//年 : 2位
            ,M  : date.getMonth() + 1  //月 : 如果1位的时候不补0
            ,MM : paddNum(date.getMonth() + 1) //月 : 如果1位的时候补0
            ,d  : date.getDate()   //日 : 如果1位的时候不补0
            ,dd : paddNum(date.getDate())//日 : 如果1位的时候补0
            ,hh : paddNum(date.getHours())  //时
            ,mm : paddNum(date.getMinutes()) //分
            ,ss : paddNum(date.getSeconds()) //秒
        }
        format || (format = "yyyy-MM-dd hh:mm");
        return format.replace(/([a-z])(\1)*/ig,function(m){return cfg[m];});
    });

    template.helper('imgsrc', function imgsrc(img, size, defaultImg){
        var IMG_DOMAIN = 'http://thumb.vpgamecdn.com/';
        img == null || img == "" || img == undefined ? img = defaultImg || "" : 0;
        return img.indexOf('http://') == -1 && img.indexOf('//') == -1
                ? IMG_DOMAIN + img + '/c/' + size : img;
    });
    template.helper('isOrdoing', function (date) {
        var currentTime = new Date().getTime() / 1000;
        return currentTime > date;
    });
</script>
